<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>简易计算器</title>
    <script>
        function f1(){
            let num1 =parseInt (document.getElementById('num1').value);
            let num2 =parseInt (document.getElementById('num2').value);
            let result=document.getElementById("result")
            result.textContent = '';
            let test = document.createTextNode(num1+num2);
            result.appendChild(test);
        }
        function f2(){
            let num1 =parseInt (document.getElementById('num1').value);
            let num2 =parseInt (document.getElementById('num2').value);
            let result=document.getElementById("result")
            result.textContent = '';
            let test = document.createTextNode(num1-num2);
            result.appendChild(test);
        }
        function f3(){
            let num1 =parseInt (document.getElementById('num1').value);
            let num2 =parseInt (document.getElementById('num2').value);
            let result=document.getElementById("result")
            result.textContent = '';
            let test = document.createTextNode(num1*num2);
            result.appendChild(test);
        }
        function f4(){
            let num1 =parseInt (document.getElementById('num1').value);
            let num2 =parseInt (document.getElementById('num2').value);
            let result=document.getElementById("result")
            result.textContent = '';
            let test = document.createTextNode(num1/num2);
            result.appendChild(test);
        }

    </script>

</head>
<body>
<table>
    <tr>
        <td>第一个数:</td>
        <td><input type="text" id="num1"></td>
    </tr>
    <tr>
        <td>第二个数:</td>
        <td><input type="text" id="num2"></td>
    </tr>
    <tr>
        <td colspan="2" align="center">
            <input type="button"  value="&nbsp;&nbsp;&nbsp;+&nbsp;&nbsp;&nbsp;" onclick="f1()">
            <input type="button"  value="&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;" onclick="f2()">
            <input type="button"  value="&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;" onclick="f3()">
            <input type="button"  value="&nbsp;&nbsp;&nbsp;÷&nbsp;&nbsp;&nbsp;" onclick="f4()">
        </td>
    </tr>
    <tr>
        <td>计算结果</td>
        <td>
            <span id="result"></span>
        </td>
    </tr>
</table>
</body>
</html>